#include <iostream>
using namespace std;
#pragma warning(disable : 4996)
#include "device.h"

int Device::idGenerator = 1000;//#WD[1] RonnyR 3.12

Device::Device(const char* n)
{
	setName(n);
	idNumber = idGenerator++;//#WD[1] RonnyR 3.12
}

void Device::setName(const char* n)
{
	strcpy(name, n);
}

//void Device::show() const
//{
//	cout << "Name: " << name <<" , Id: "<<idNumber<<endl; //#WD[1] RonnyR 3.12
//}

/*bool Device::equals(const Device& other) const
{
	return strcmp(name, other.name) == 0 ? true : false;
}
*/

bool Device::operator==(const Device &other) const
{
return  this->idNumber == other.idNumber ? true : false;
}
ostream & operator<<(ostream & os,const Device & D) //#WD[2] RonnyR 3.12
{
os << "Name: " << D.getName() <<" , Id: "<<D.getIdNumber()<<" "; //#WD[1] RonnyR 3.12
return os;
}

istream & operator>>(istream & in,Device & D)
{
char temp[50];
in.getline(temp, 50);
D.setName(temp);				
return in;

}

/*const Device & Device::operator=(const Device & D)						   //#WD[2] RonnyR 3.12
{
strcpy(name,D.getName());
idNumber = D.getIdNumber();

return *this;		
}
*/

